package pv.dao;

import java.util.List;

import pv.dto.AbstractDTO;
import android.database.sqlite.SQLiteDatabase;

public abstract class AbstractDAO {
	SQLiteHelper dbHelper;

	public AbstractDAO(SQLiteHelper dbHelper) {
		this.dbHelper = dbHelper;
	}

	protected static final String COLUMN_NAME_NULLABLE = null;

	public long insert(AbstractDTO dto) {
		SQLiteDatabase db = dbHelper.getWritableDatabase();
		long result = insert(dto, db);
		db.close();
		return result;
	}

	public long insert(AbstractDTO dto, SQLiteDatabase db) {
		return -1;
	}

	public AbstractDTO[] getRows() {
		SQLiteDatabase db = dbHelper.getReadableDatabase();
		AbstractDTO[] result = getRows(db);
		db.close();
		return result;
	}

	public AbstractDTO[] getRows(SQLiteDatabase db) {
		return null;
	}

	public AbstractDTO[] getRows(String[] projection, String whereColumn,
			String[] whereValue, String sortOrder) {
		SQLiteDatabase db = dbHelper.getReadableDatabase();
		AbstractDTO[] result = getRows(projection, whereColumn, whereValue,
				sortOrder, db);
		db.close();
		return result;
	}

	public AbstractDTO[] getRows(String[] projection, String whereColumn,
			String[] whereValue, String sortOrder, SQLiteDatabase db) {
		return null;
	}

}
